package com.niiwoo.civet.trade.service.dubbo.invest;


import com.alibaba.dubbo.config.annotation.Service;
import com.niiwoo.civet.trade.dto.request.InvestOrderListRequestDTO;
import com.niiwoo.civet.trade.dto.request.myloan.MyloanRequestDTO;
import com.niiwoo.civet.trade.dto.response.InvestOrderListResponseDTO;
import com.niiwoo.civet.trade.dto.response.InvestOrderReceivePaymentDetailDTO;
import com.niiwoo.civet.trade.dto.response.InvestOrderReceivePaymentPlanDTO;
import com.niiwoo.civet.trade.dto.response.ReceivableDetailResponseDTO;
import com.niiwoo.civet.trade.dto.response.myloan.inner.BackToArticleDetails;
import com.niiwoo.civet.trade.service.invest.ReceivePaymentPlanDubboService;
import com.niiwoo.civet.trade.service.local.invest.ReceivePaymentPlanService;
import com.niiwoo.tripod.provider.dto.response.PageResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;

import java.util.List;


/**
 * 订单详情-回款计划
 * Created by zhangwanli on 2018/5/16.
 */

@Service(version = "1.0.0")
public class ReceivePaymentPlanDubboServiceImpl implements ReceivePaymentPlanDubboService {

    @Autowired
    ReceivePaymentPlanService receivePaymentPlanService;

    @Override
    public List<InvestOrderReceivePaymentPlanDTO> receivePaymentPlanList(Long investOrderId) {
        Assert.notNull(investOrderId, "investOrderId is not null");
        return receivePaymentPlanService.receivePaymentPlanList(investOrderId);
    }

    @Override
    public InvestOrderReceivePaymentDetailDTO receivePaymentPlanDetail(Long investOrderId, Long planId) {
        Assert.notNull(planId, "planId is not null");
        Assert.notNull(investOrderId, "investOrderId is not null");
        return receivePaymentPlanService.receivePaymentPlanDetail(investOrderId, planId);
    }

    @Override
    public PageResponseDTO<InvestOrderListResponseDTO> investOrderList(InvestOrderListRequestDTO requestDTO) {
        Assert.notNull(requestDTO, "requestDTO is not null");
        Assert.notNull(requestDTO.getType(), "type is not null");
        Assert.notNull(requestDTO.getUserId(), "userId is not null");
        Assert.notNull(requestDTO.getStatus(), "status is not null");
        return receivePaymentPlanService.investOrderList(requestDTO);
    }

    @Override
    public ReceivableDetailResponseDTO receivableDetail(Long investOrderId) {
        Assert.notNull(investOrderId, "investOrderId is not null");
        return receivePaymentPlanService.receivableDetail(investOrderId);
    }

    @Override
    public List<BackToArticleDetails> receivableCalendar(MyloanRequestDTO requestDTO){
        Assert.notNull(requestDTO, "requestDTO is not null");
        Assert.notNull(requestDTO.getUserId(), "userId is not null");
        Assert.notNull(requestDTO.getStartTime(), "startTime is not null");
        Assert.notNull(requestDTO.getEndTime(), "endTime is not null");
        return receivePaymentPlanService.receivableCalendar(requestDTO);
    }
}
